package com.my.cd.mediator;

/**
 * 与中介者沟通的工作者抽象基类（工作者同事类）
 */
public abstract class Worker {
    protected String name;
    private Mediator mediator;

    public Worker(String name, Mediator mediator) {
        this.mediator = mediator;
        this.name = name;
    }

    public Mediator getMediator() {
        return this.mediator;
    }

    /**
     * 具体工作者需要实现与中介者沟通的抽象方法
     */
    public abstract void sendMessage(int stateChange);
}
